package org.sippr.rvt2ifc.controller;

import org.sippr.rvt2ifc.pojo.ProjectMark;
import org.sippr.rvt2ifc.pojo.Result;
import org.sippr.rvt2ifc.pojo.XktModel;
import org.sippr.rvt2ifc.service.ProjectMarkService;
import org.sippr.rvt2ifc.service.XktModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/xkt")
@Validated//字符串长度等合法性校验
public class XktModelController {
    @Autowired
    private XktModelService xktModelService;

    @PostMapping("/insert")
    public Result insert(@RequestBody XktModel value) {
        xktModelService.insert(value);
        return Result.success();
    }

    @GetMapping("/list/{state}")
    public Result listByState(@PathVariable Integer state) {
        List<XktModel> list = xktModelService.listByState(state);
        return Result.success(list);
    }

    @PostMapping("/updateState")
    public Result updateState(String fileUuid, Short state) {
        xktModelService.updateState(fileUuid, state);
        return Result.success();
    }
}
